﻿@model Parichay.Domain.Models.MessageHomeModel

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
    
}
@section Styles {
<link href="@Url.Content("~/Content/Styles/jquery.ui.css")" rel="stylesheet" type="text/css" />

}

@section Scripts
{
<script src="@Url.Content("~/Content/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function ($) {

        $('DIV.modalWin').dialog({ autoOpen: false }); // or hide in css
        //$('DIV.modalWin').modal();


        $('a.openModal').click(function () {
            var divNm = '#' + $(this).attr('data-name');
            $(divNm).dialog('open');
        });

        $('DIV.rplyBox').toggle('slow');

        $('a.showreply').click(function () {
            var divNm = '#' + $(this).attr('data-name');
            $(divNm).toggle('slow');
        });
    });
</script>
}
@using (Html.BeginForm("Index", "Message"))
{
    @Html.ValidationSummary(true)    
<h2>My Messages</h2>
    if (Model.myMessages != null)
    {
 <div class="cmtMainBox">
     <div class="cmtHeading"><span>My Messages:</span></div>
@foreach (Parichay.Domain.MemberMessage msg in Model.myMessages)
{
@Html.Partial("BO/msg", msg);
}
</div>
    }
<br />
<br />

    <table class="tblAllBorders" width="400px">
    <tr><th colspan="2">Find a User to Send Message:</th></tr>
<tr><td>
<input type="text" id="txtUserNameToSearch" name="txtUserNameToSearch" />
<input type="submit" value="Find" name="btnSubmit" /></td>
</tr>
<tr>
<td><div id="outpDiv">
@if (Model.userSearchResults != null)
{
    @Html.Partial("UsrSrch", Model.userSearchResults);
}
</div></td>
</tr>
<tr>
<td>
<table class="tblAllBorders">
        <tr><th>Send Message:</th></tr>
        <tr><td><div class="editor-field">
            @Html.TextAreaFor(model => model.txtMessageToSend, 2, 58, null)
            @Html.ValidationMessageFor(model => model.txtMessageToSend)
        </div></td></tr>
        <tr>
        <td style="text-align:right"><input type="submit" value="Send" name="btnSubmit" onclick="if(!confirm('Are you sure you want to send this message?')){return false;}" /></td>
        </tr>
        </table>
</td>
</tr>
</table>



}